<template>
	<view class="">
		<view class="" style="background: linear-gradient(46deg, #00C2CF 0%, #1ED2BE 100%);">
			<u-navbar :custom-back="$navBack" is-back backIconColor="#fff" titleColor="#fff" :border-bottom="false"
				title="转单" title-bold :is-fixed="false" :background="{background:'#fff0'}">
			</u-navbar>
			<view class="p20 flex w-max">
				<u-search placeholder="输入陪诊师姓名搜索" height="72" bg-color="#fff" class="flex1 " :show-action="false"
					:search-icon-color="$zs" disabled @click="">
				</u-search>
			</view>
		</view>
		<view class="p20">
			<u-empty v-if="!list.length" />
			<view class="flex pt32 pb32 border-b" @click="master_id=item.master_id" v-for="(item,index1) in list"
				:key="index1">
				<view class="color-666 flex1">
					<text>{{item.name}}</text>
				</view>
				<view class="w36 h36">
					<image src="/static/img/icon/oneSel1.png" v-if="master_id==item.master_id" class="wh-max" mode="" />
					<image src="/static/img/icon/oneSel0.png" v-else class="wh-max" mode=""></image>
				</view>
			</view>
		</view>
		<view class="h120"></view>
		<view class="pf bottom0 left0  w-max flex">
			<view class="p24 flex1">
				<u-button type="warning" ripple plain @click="$navBack()">取消</u-button>
			</view>
			<view class="p24 flex1">
				<u-button type="warning" ripple @click="submit()">确认</u-button>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				keyword: '',
				list: [],

				master_id: ''
			};
		},
		watch: {
			keyword(e) {
				this.$u.debounce(this.getList, 500)
				// this.getList()
			},
		},
		onLoad(e) {
			this.getList()
		},
		methods: {
			submit(item) {
				let params = {
					...this.$params,
					master_id: this.master_id,
				}
				if (!params.master_id) return this.$msg('请选择陪诊师')
				this.$request('/master/task/transferOrder', params).then(res => {
					this.$msg(res.msg)
					setTimeout(this.$navBack, 1000)
				})
			},
			getList() {
				let params = {
					keyword: this.keyword,
					...this.$params,
				}
				this.$request('/master/task/getTransferMaster', params).then(res => {
					this.list = res.data.data
				})
			},
		}
	}
</script>

<style lang="scss">
	page {
		height: 100%;
		background: #fff;
	}

	.tab-active::before {
		content: "";
		position: absolute;
		border-left: 4px solid $zs;
		height: 40%;
		left: 0;
		// top: 39rpx;
		top: 50%;
		transform: translateY(-50%);
	}
</style>
